package org.easyspring.util;

import java.util.Collection;
import java.util.Map;

/**
 * Created by Hy on 2021/7/30
 */
public class ValidationUtil {
    private ValidationUtil() {}

    /**
     * 字符串是否为null或者””
     * @param str
     * @return
     */
    public static boolean isEmpty(String str){
        return str == null || str.equals("");
    }

    /**
     * Collection是否为null或者size为0
     * @param obj
     * @return
     */
    public static boolean isEmpty(Collection<?> obj){
        return obj == null || obj.isEmpty();
    }

    /**
     * Oject[]是否为null或者size为0
     * @param obj
     * @return
     */
    public static boolean isEmpty(Object[] obj){
        return obj == null || obj.length ==0;
    }
    public static boolean isEmpty(Map map){
        return map == null || map.isEmpty();
    }
}
